Component({
  options: {
    styleIsolation: "shared",
  },
  properties: {
    dropdownItems: {
      type: Array,
      value: [],
    },
    selectedItem: String,
  },

  data: {
    selectedItem: "",
    isDropdownOpen: false,
  },

  methods: {
    toggleDropdown: function () {
      this.setData({
        isDropdownOpen: !this.data.isDropdownOpen,
      });
    },
    selectItem: function (e) {
      wx.setStorageSync("tenantCode", e.target.dataset.code);
      wx.setStorageSync("tenantName", e.target.dataset.name);
      this.setData({
        selectedItem: e.target.dataset.name,
        isDropdownOpen: false,
      });
    },
  },
});
